

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>agpy.hotwind &mdash; agpy 0.1.2 documentation</title>
    
    <link rel="stylesheet" href="../../_static/extra.css" type="text/css" />
    <link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
    
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '../../',
        VERSION:     '0.1.2',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="../../_static/jquery.js"></script>
    <script type="text/javascript" src="../../_static/underscore.js"></script>
    <script type="text/javascript" src="../../_static/doctools.js"></script>
    <link rel="top" title="agpy 0.1.2 documentation" href="../../index.html" />
    <link rel="up" title="agpy" href="../agpy.html" />
     
    <script type="text/javascript">

      var _gaq = _gaq || [];
      _gaq.push(['_setDomainName', 'pyspeckit.bitbucket.org']);
      _gaq.push(['_setAllowHash', false]);
      _gaq.push(['_trackPageview']);


    </script>
    <link rel="stylesheet" type="text/css" href="../../_static/extra.css" />
  </head>
  <body>
    <div class="header-wrapper">
      <div class="header">
        <h1><a href="../../index.html">agpy 0.1.2 documentation</a></h1>
        <div class="rel">
          <a href="http://agpy.googlecode.com">agpy Home </a>  |
          <a href=../../index.html>Docs Home </a>  |
          <a href="http://code.google.com/p/agpy/w/list">Wiki</a>  |
          <a href=../../search.html>Search </a>
        </div>
       </div>
    </div>

    <div class="content-wrapper">
      <div class="content">
        <div class="document">
            
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <h1>Source code for agpy.hotwind</h1><div class="highlight"><pre>
<span class="c"># formulae for hot wind computations</span>
<span class="c">#</span>
<span class="c"># Panagia &amp; Felli 1975 / Wright &amp; Barlow 1975:</span>
<span class="kn">from</span> <span class="nn">agpy.constants</span> <span class="kn">import</span> <span class="o">*</span>
<span class="kn">from</span> <span class="nn">numpy</span> <span class="kn">import</span> <span class="n">log10</span><span class="p">,</span><span class="n">exp</span><span class="p">,</span><span class="n">log</span>

<div class="viewcode-block" id="mdot"><a class="viewcode-back" href="../../agpy.html#agpy.hotwind.mdot">[docs]</a><span class="k">def</span> <span class="nf">mdot</span><span class="p">(</span><span class="n">snu</span><span class="p">,</span> <span class="n">nu</span><span class="o">=</span><span class="mi">10</span><span class="p">,</span> <span class="n">Te</span><span class="o">=</span><span class="mf">1e4</span><span class="p">,</span> <span class="n">vinf</span><span class="o">=</span><span class="mi">2000</span><span class="p">,</span> <span class="n">mue</span><span class="o">=</span><span class="mf">1.3</span><span class="p">,</span> <span class="n">d</span><span class="o">=</span><span class="mi">1</span><span class="p">):</span>
    <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">    [snu] = mJy</span>
<span class="sd">    nu = 10 GHz (frequency)</span>
<span class="sd">    Te = 10^4 K (ionized gas temp)</span>
<span class="sd">    vinf = 2000 km/s (maximum wind speed)</span>
<span class="sd">    mue = 1.3 (mean atomic weight per free electron)</span>
<span class="sd">    d = distance (kpc)</span>

<span class="sd">    return: mdot in Msun/yr</span>
<span class="sd">    &quot;&quot;&quot;</span>
    <span class="n">mdot</span> <span class="o">=</span> <span class="p">(</span> <span class="n">snu</span> <span class="o">/</span> <span class="mf">7.26</span> <span class="o">*</span> <span class="p">(</span><span class="n">nu</span><span class="o">/</span><span class="mf">10.</span><span class="p">)</span><span class="o">**-</span><span class="mf">0.6</span> <span class="o">*</span> <span class="p">(</span><span class="n">Te</span><span class="o">/</span><span class="mf">1e4</span><span class="p">)</span><span class="o">**-</span><span class="mf">0.1</span> <span class="o">*</span> <span class="n">d</span><span class="o">**</span><span class="mi">2</span> <span class="o">*</span> <span class="p">(</span><span class="n">mue</span><span class="o">*</span><span class="n">vinf</span><span class="o">/</span><span class="mi">100</span><span class="p">)</span><span class="o">**</span><span class="p">(</span><span class="mi">4</span><span class="o">/</span><span class="mf">3.</span><span class="p">)</span> <span class="p">)</span> <span class="o">**</span><span class="p">(</span><span class="mi">3</span><span class="o">/</span><span class="mf">4.</span><span class="p">)</span> <span class="o">*</span> <span class="mf">1e-6</span>
    <span class="k">return</span> <span class="n">mdot</span>
</div>
<div class="viewcode-block" id="mdotvinfr"><a class="viewcode-back" href="../../agpy.html#agpy.hotwind.mdotvinfr">[docs]</a><span class="k">def</span> <span class="nf">mdotvinfr</span><span class="p">(</span><span class="n">snu</span><span class="p">,</span> <span class="n">nu</span><span class="o">=</span><span class="mi">10</span><span class="p">,</span> <span class="n">Te</span><span class="o">=</span><span class="mf">1e4</span><span class="p">,</span> <span class="n">vinf</span><span class="o">=</span><span class="mi">2000</span><span class="p">,</span> <span class="n">mue</span><span class="o">=</span><span class="mf">1.3</span><span class="p">,</span> <span class="n">d</span><span class="o">=</span><span class="mi">1</span><span class="p">,</span> <span class="n">R</span><span class="o">=</span><span class="mi">25</span><span class="p">):</span>
    <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">    [snu] = mJy</span>
<span class="sd">    nu = 10 GHz (frequency)</span>
<span class="sd">    Te = 10^4 K (ionized gas temp)</span>
<span class="sd">    vinf = 2000 km/s (maximum wind speed)</span>
<span class="sd">    mue = 1.3 (mean atomic weight per free electron)</span>
<span class="sd">    d = distance (kpc)</span>

<span class="sd">    return: Dmom in g*cm/s^2</span>

<span class="sd">    Sp. type Log D0 x alphaP</span>
<span class="sd">    A I 14.22 	 2.41 2.64 	 0.47 0.38 	 0.07</span>
<span class="sd">    Mid B I 17.07 	 1.05 1.95 	 0.20 0.51 	 0.05</span>
<span class="sd">    Early B I 21.24 	 1.38 1.34 	 0.25 0.75 	 0.15</span>
<span class="sd">    O I 20.69 	 1.04 1.51 	 0.18 0.66 	 0.06</span>
<span class="sd">    O III, V 19.87 	 1.21 1.57 	 0.21 0.64 	 0.06</span>

<span class="sd">    &quot;&quot;&quot;</span>
    <span class="n">mdot</span> <span class="o">=</span> <span class="p">(</span> <span class="n">snu</span> <span class="o">/</span> <span class="mf">7.26</span> <span class="o">*</span> <span class="p">(</span><span class="n">nu</span><span class="o">/</span><span class="mf">10.</span><span class="p">)</span><span class="o">**-</span><span class="mf">0.6</span> <span class="o">*</span> <span class="p">(</span><span class="n">Te</span><span class="o">/</span><span class="mf">1e4</span><span class="p">)</span><span class="o">**-</span><span class="mf">0.1</span> <span class="o">*</span> <span class="n">d</span><span class="o">**</span><span class="mi">2</span> <span class="o">*</span> <span class="p">(</span><span class="n">mue</span><span class="o">*</span><span class="n">vinf</span><span class="o">/</span><span class="mi">100</span><span class="p">)</span><span class="o">**</span><span class="p">(</span><span class="mi">4</span><span class="o">/</span><span class="mf">3.</span><span class="p">)</span> <span class="p">)</span> <span class="o">**</span><span class="p">(</span><span class="mi">3</span><span class="o">/</span><span class="mf">4.</span><span class="p">)</span> <span class="o">*</span> <span class="mf">1e-6</span>
    <span class="k">return</span> <span class="n">mdot</span><span class="o">*</span><span class="n">msun</span><span class="o">/</span><span class="n">yr</span> <span class="o">*</span> <span class="p">(</span><span class="n">vinf</span><span class="o">*</span><span class="mf">1e5</span><span class="p">)</span> <span class="o">*</span> <span class="p">(</span><span class="n">R</span><span class="p">)</span><span class="o">**</span><span class="mf">0.5</span>
</div>
<div class="viewcode-block" id="LofMdot"><a class="viewcode-back" href="../../agpy.html#agpy.hotwind.LofMdot">[docs]</a><span class="k">def</span> <span class="nf">LofMdot</span><span class="p">(</span><span class="n">logdmom</span><span class="p">,</span> <span class="n">x</span><span class="o">=</span><span class="mf">1.51</span><span class="p">,</span> <span class="n">D0</span><span class="o">=</span><span class="mf">20.69</span><span class="p">,</span> <span class="n">alphaP</span><span class="o">=</span><span class="mf">0.66</span><span class="p">):</span>
    <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">    Kudritzki 2000</span>
<span class="sd">    log Dmom - log D0 = x log(L/Lsun); Dmom = Mdot * vinf *R/rsun</span>

<span class="sd">    returns L in log10(Lsun)</span>
<span class="sd">    &quot;&quot;&quot;</span>

    <span class="n">L</span> <span class="o">=</span> <span class="p">(</span> <span class="p">(</span><span class="n">logdmom</span><span class="o">-</span><span class="n">D0</span><span class="p">)</span> <span class="o">/</span> <span class="n">x</span> <span class="p">)</span>
    <span class="k">return</span> <span class="n">L</span>
</div>
<div class="viewcode-block" id="SnuOfMdot"><a class="viewcode-back" href="../../agpy.html#agpy.hotwind.SnuOfMdot">[docs]</a><span class="k">def</span> <span class="nf">SnuOfMdot</span><span class="p">(</span><span class="n">nu</span><span class="p">,</span> <span class="n">dkpc</span><span class="p">,</span> <span class="n">mdot</span><span class="o">=</span><span class="mf">1e-5</span><span class="p">,</span> <span class="n">mu</span><span class="o">=</span><span class="mf">1.2</span><span class="p">,</span> <span class="n">vwind</span><span class="o">=</span><span class="mf">1e3</span><span class="p">,</span> <span class="n">Zbar</span><span class="o">=</span><span class="mi">1</span><span class="p">,</span> <span class="n">Te</span><span class="o">=</span><span class="mf">1e4</span><span class="p">):</span> 
    <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">    Panagia and Felli 1975 equation 24</span>

<span class="sd">    [nu] = GHz</span>
<span class="sd">    [Te] = K</span>
<span class="sd">    [mdot] = msun/yr</span>
<span class="sd">    [vwind] = km/s</span>
<span class="sd">    mu = mean particle mass in AMU (presumably)</span>
<span class="sd">    Zbar = average ionic charge (assumed 1, but not sure that&#39;s good)</span>
<span class="sd">    dkpc = distance in kpc</span>
<span class="sd">    &quot;&quot;&quot;</span>

    <span class="n">snu</span> <span class="o">=</span> <span class="mf">5.12</span> <span class="o">*</span> <span class="p">(</span> <span class="p">(</span><span class="n">nu</span><span class="o">/</span><span class="mf">10.</span><span class="p">)</span><span class="o">**</span><span class="mf">0.6</span> <span class="o">*</span> <span class="p">(</span><span class="n">Te</span><span class="o">/</span><span class="mf">1e4</span><span class="p">)</span><span class="o">**</span><span class="mf">0.1</span> <span class="o">*</span> <span class="p">(</span><span class="n">mdot</span><span class="o">/</span><span class="mf">1e-5</span><span class="p">)</span><span class="o">**</span><span class="p">(</span><span class="mi">4</span><span class="o">/</span><span class="mf">3.</span><span class="p">)</span> <span class="o">*</span>
            <span class="p">(</span><span class="n">mu</span><span class="o">/</span><span class="mf">1.2</span><span class="p">)</span><span class="o">**</span><span class="p">(</span><span class="o">-</span><span class="mi">4</span><span class="o">/</span><span class="mf">3.</span><span class="p">)</span> <span class="o">*</span> <span class="p">(</span><span class="n">vwind</span><span class="o">/</span><span class="mf">1e3</span><span class="p">)</span><span class="o">**</span><span class="p">(</span><span class="o">-</span><span class="mi">4</span><span class="o">/</span><span class="mf">3.</span><span class="p">)</span> <span class="o">*</span> <span class="p">(</span><span class="n">Zbar</span><span class="p">)</span><span class="o">**</span><span class="p">(</span><span class="mi">2</span><span class="o">/</span><span class="mf">3.</span><span class="p">)</span> <span class="o">*</span>
            <span class="p">(</span><span class="n">dkpc</span><span class="p">)</span><span class="o">**-</span><span class="mf">2.</span><span class="p">)</span>

    <span class="c"># 1 mfu = 1 milli-flux-unit = 10^-29 W m^-2 Hz ^-1 = 1 mJy</span>
    <span class="k">return</span> <span class="n">snu</span></div>
</pre></div>

          </div>
        </div>
      </div>
        </div>
        <div class="sidebar">
          <h3>Table Of Contents</h3>
          <ul>
<li class="toctree-l1"><a class="reference internal" href="../../agpy.html">Adam Ginsburg&#8217;s Python Code (agpy)</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../image_tools.html">Image Tools</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../fft_tools.html">AG_fft_tools Package</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../plfit.html">plfit Package</a></li>
</ul>

          <h3 style="margin-top: 1.5em;">Search</h3>
          <form class="search" action="../../search.html" method="get">
            <input type="text" name="q" />
            <input type="submit" value="Go" />
            <input type="hidden" name="check_keywords" value="yes" />
            <input type="hidden" name="area" value="default" />
          </form>
          <p class="searchtip" style="font-size: 90%">
            Enter search terms or a module, class or function name.
          </p>
        </div>
        <div class="clearer"></div>
      </div>
    </div>

    <div class="footer">
      &copy; Copyright 2011, Adam Ginsburg.
      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.2pre.
    <script type="text/javascript">

      var _gaq = _gaq || [];
      _gaq.push(['_setAccount', 'UA-6253248-2']);
      _gaq.push(['_trackPageview']);

      (function() {
        var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
        ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
        var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
      })();

    </script>
        
    </div>
  </body>
</html>